home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / Python-1.4 / Lib / types.py < prev    next >
Text File  |  1998-06-24  |  1KB  |  54 lines

  1. # Define names for all type symbols known in the standard interpreter.
  2. # Types that are part of optional modules (e.g. array) are not listed.
  3.  
  4. import sys
  5.  
  6. NoneType = type(None)
  7. TypeType = type(NoneType)
  8.  
  9. IntType = type(0)
  10. LongType = type(0L)
  11. FloatType = type(0.0)
  12. try:
  13.     ComplexType = type(complex(0,1))
  14. except NameError:
  15.     pass
  16.  
  17. StringType = type('')
  18.  
  19. TupleType = type(())
  20. ListType = type([])
  21. DictType = DictionaryType = type({})
  22.  
  23. def _f(): pass
  24. FunctionType = type(_f)
  25. LambdaType = type(lambda: None)        # Same as FunctionType
  26. CodeType = type(_f.func_code)
  27.  
  28. class _C:
  29.     def _m(self): pass
  30. ClassType = type(_C)
  31. UnboundMethodType = type(_C._m)        # Same as MethodType
  32. _x = _C()
  33. InstanceType = type(_x)
  34. MethodType = type(_x._m)
  35.  
  36. BuiltinFunctionType = type(len)
  37. BuiltinMethodType = type([].append)    # Same as BuiltinFunctionType
  38.  
  39. ModuleType = type(sys)
  40.  
  41. FileType = type(sys.stdin)        # XXX what if it was assigned to?
  42. XRangeType = type(xrange(0))
  43.  
  44. try:
  45.     raise TypeError
  46. except TypeError:
  47.     TracebackType = type(sys.exc_traceback)
  48.     FrameType = type(sys.exc_traceback.tb_frame)
  49.  
  50. SliceType = type(slice(0))
  51. EllipsisType = type(Ellipsis)
  52.  
  53. del sys, _f, _C, _x            # Not for export
  54.